<!DOCTYPE html>
<html>
	<head th:include="/common/head :: head">
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />
	</head>
<body>
	<div class="x-body">
		<form class="layui-form" lay-filter="query_form">
			<div class="layui-form-item">
				<label for=title class="layui-form-label">结果标题
				</label>
				<div class="layui-input-inline">
					<input type="text" id="title" name="title" required=""
						 autocomplete="off" class="layui-input" readOnly="readOnly">
				</div>
			</div>
			<div class="layui-form-item">
				<label for="predictDate" class="layui-form-label">预测时间
				</label>
				<div class="layui-input-inline">
					<input type="text" id="predictDate" name="predictDate" readOnly
						 autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label for="predictType" class="layui-form-label">预测类型
				</label>
				<div class="layui-input-inline">
					<input type="text" id="predictType" name="predictType" readOnly
						 autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label for="result" class="layui-form-label">预测结果
				</label>
				<div class="layui-input-block">
                  <textarea  id="result" name="result" autocomplete="off" readOnly class="layui-textarea"></textarea>
                </div>
			</div>
			<div class="layui-form-item">
				<label for="L_repass" class="layui-form-label"> </label>
				<button class="layui-btn" onclick="black()">返回</button>
			</div>
		</form>
	</div>
</body>
</html>
<script>
	$(function(){
		//初始化
		init();
	})
	var predictId = sessionStorage.getItem("predictId");
	//通过id拿到对象
	function init(){
		$.post("/predict/getPredictById","predictId="+predictId,function(result){
			if(result.status==0){
				//初始化赋值）
				initQuery(result.data);
			}else{
				layer.msg(result.msg);
			}
		})
	}
	//初始化（赋值）
	function initQuery(predict){
		layui.use(['form','layer'],function(){
			$=layui.jquery;
			var form = layui.form,
			layer = layui.layer;
			//赋值
			var date= predict.predictDate;
			var times= date.split("-");
			var time = times[0]+"年"+times[1]+"月份";
			form.val('query_form',{
				"title":predict.title,
				"predictDate":time,
				"result":predict.result
			})
			if(predict.predictType==1){
				form.val("query_form",{
					"predictType":"部门预测"
				})
			}
			if(predict.predictType==2){
				form.val("query_form",{
					"predictType":"整体预测"
				})
			}
		})
	}
	//返回
	function black(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	}
	
</script>
